\hypertarget{printf_8c}{}\section{printf/printf.c File Reference}
\label{printf_8c}\index{printf/printf.\+c@{printf/printf.\+c}}


Small printf, and verious conversion code with floating point support.  


{\ttfamily \#include $<$stdint.\+h$>$}\\*
{\ttfamily \#include $<$stdarg.\+h$>$}\\*
{\ttfamily \#include $<$string.\+h$>$}\\*
{\ttfamily \#include $<$math.\+h$>$}\\*
{\ttfamily \#include \char`\"{}mathio.\+h\char`\"{}}\\*
\subsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structp__ch__t}{p\+\_\+ch\+\_\+t}
\begin{DoxyCompactList}\small\item\em Data structure for character buffer with limits. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} \hyperlink{cpu_8h_aea0c7eab1ce1eebb4e879ef4e23c16ee}{size\+\_\+t} \hyperlink{mmc__hal_8h_a399da2caab82ec1bb3d5a8fbc5306768}{W\+E\+A\+K\+\_\+\+A\+TR} \hyperlink{printf_8c_a895ea3a2f9901e4c962806cc15271339}{strlen} (const char $\ast$str)
\begin{DoxyCompactList}\small\item\em String Length. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} int \hyperlink{mmc__hal_8h_a399da2caab82ec1bb3d5a8fbc5306768}{W\+E\+A\+K\+\_\+\+A\+TR} \hyperlink{printf_8c_a8c33a3f5b4322e705d3403f63d55b0a1}{isdigit} (int c)
\begin{DoxyCompactList}\small\item\em test if a character is a digit \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} void \hyperlink{mmc__hal_8h_a399da2caab82ec1bb3d5a8fbc5306768}{W\+E\+A\+K\+\_\+\+A\+TR} \hyperlink{printf_8c_a00b9d97be21e4f3f5df1019a803c05a6}{reverse} (char $\ast$str)
\begin{DoxyCompactList}\small\item\em Reverse a string in place Example\+: abcdef -\/$>$ fedcba. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} void \hyperlink{mmc__hal_8h_a399da2caab82ec1bb3d5a8fbc5306768}{W\+E\+A\+K\+\_\+\+A\+TR} \hyperlink{printf_8c_a25ac5a1dbdfa1d06d55448cd7b665d1d}{strupper} (char $\ast$str)
\begin{DoxyCompactList}\small\item\em U\+P\+P\+E\+R\+C\+A\+SE a string. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} int \hyperlink{printf_8c_aa95ef42dcc41a90255c084e0e1a9bcde}{bin2num} (\hyperlink{send_8c_aba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t} $\ast$str, int strmax, int nummin, int base, \hyperlink{send_8c_aba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t} $\ast$nump, int numsize, int sign\+\_\+ch)
\begin{DoxyCompactList}\small\item\em Convert an unsigned number (numsize bytes in size) to A\+S\+C\+II in specified base Notes\+: No limit except available memory on number size. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} void \hyperlink{printf_8c_ab10e941ecf6d7512649e377e97d28fac}{pch\+\_\+init} (char $\ast$str, int max)
\begin{DoxyCompactList}\small\item\em Initialize character buffer with limits. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} int \hyperlink{printf_8c_ab454b0d961c8dc93406cc75379c8a1f5}{pch} (char ch)
\begin{DoxyCompactList}\small\item\em Put character in buffer with limits. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} int \hyperlink{printf_8c_a642ddbb02955bf5cb540f7a2f0f09aae}{pch\+\_\+ind} ()
\begin{DoxyCompactList}\small\item\em Return current index of character buffer with limits. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} int \hyperlink{printf_8c_a4188dbfea9bea20687558f35bc34c00d}{pch\+\_\+max\+\_\+ind} ()
\begin{DoxyCompactList}\small\item\em Return maximum valid index for character buffer. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} void \hyperlink{printf_8c_a9c08c55e823a7532f2344a77ef296b4e}{print\+\_\+flags} (\hyperlink{unionf__t}{f\+\_\+t} f)
\begin{DoxyCompactList}\small\item\em print flags set in t\+\_\+t structure \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} int \hyperlink{printf_8c_ab538bcf34e0347b5c0329666ab58d0e2}{p\+\_\+ntoa} (\hyperlink{send_8c_aba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t} $\ast$nump, int numsize, char $\ast$str, int strmax, int radix, int width, int prec, \hyperlink{unionf__t}{f\+\_\+t} f)
\begin{DoxyCompactList}\small\item\em Convert number an base 2 .. 16 to A\+S\+C\+II with optional sign Notes\+: 1) Numbers can be any number of digits long -\/ limited only by memory available To print negative numbers convert to positive before calling this function and set f.\+b.\+neg 2) Warning\+: as with printf width and prec are only minimum sizes -\/ results can be bigger We assume all numbers are positive\+: \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} void \hyperlink{printf_8c_ab713fa5c01f315bdf67d18a6dbcb4ff5}{\+\_\+puts\+\_\+pad} (\hyperlink{mathio_8h_a1efdee46bf8e5af45e76e461e8db9c09}{printf\+\_\+t} $\ast$fn, char $\ast$s, int width, int count, int left)
\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} void \hyperlink{printf_8c_a1c2762f15e2ae4dea9b52ee9e3532372}{\+\_\+printf\+\_\+fn} (\hyperlink{mathio_8h_a1efdee46bf8e5af45e76e461e8db9c09}{printf\+\_\+t} $\ast$fn, \hyperlink{mathio_8h_a9306b0c3083933632aca02ebb1fe14d5}{\+\_\+\+\_\+memx} const char $\ast$fmt, va\+\_\+list va)
\begin{DoxyCompactList}\small\item\em vsnprintf function \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} void \hyperlink{printf_8c_a9b6f7fa030ba96220b734d45d737805a}{\+\_\+putc\+\_\+buffer\+\_\+fn} (struct \hyperlink{struct__printf__t}{\+\_\+printf\+\_\+t} $\ast$p, char ch)
\begin{DoxyCompactList}\small\item\em \+\_\+putc\+\_\+buffer\+\_\+fn -\/ character output to a string buffer Used by snprintf and vsnprintf You can make \+\_\+printf\+\_\+fn call this helper for each character \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} int \hyperlink{printf_8c_a7a6349b4ca3388a0cb82fc3d1d85a6b5}{vsnprintf} (char $\ast$str, \hyperlink{cpu_8h_aea0c7eab1ce1eebb4e879ef4e23c16ee}{size\+\_\+t} size, const char $\ast$format, va\+\_\+list va)
\begin{DoxyCompactList}\small\item\em vsnprintf function \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} int \hyperlink{printf_8c_a278630a290b34d009b2e3ad7bf1fc996}{snprintf} (char $\ast$str, \hyperlink{cpu_8h_aea0c7eab1ce1eebb4e879ef4e23c16ee}{size\+\_\+t} size, const char $\ast$format,...)
\begin{DoxyCompactList}\small\item\em snprintf function \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\hyperlink{structp__ch__t}{p\+\_\+ch\+\_\+t} \hyperlink{printf_8c_aa1e6944673f3194dc3fe8ba626deec55}{\+\_\+pch}
\begin{DoxyCompactList}\small\item\em Define data structure for character buffer with limits. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Small printf, and verious conversion code with floating point support. 

\begin{DoxyParagraph}{Copyright \copyright{} 2014-\/2017 Mike Gore, All rights reserved. G\+PL License}

\end{DoxyParagraph}
\begin{DoxySeeAlso}{See also}
\href{http://github.com/magore/hp85disk}{\tt http\+://github.\+com/magore/hp85disk} 

\href{http://github.com/magore/hp85disk/COPYRIGHT.md}{\tt http\+://github.\+com/magore/hp85disk/\+C\+O\+P\+Y\+R\+I\+G\+H\+T.\+md} for specific Copyright details
\end{DoxySeeAlso}
\begin{DoxyParagraph}{You are free to use this code under the terms of G\+PL}
please retain a copy of this notice in any code you use it in.
\end{DoxyParagraph}
This is free software\+: you can redistribute it and/or modify it under the terms of the G\+NU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This software is distributed in the hope that it will be useful, but W\+I\+T\+H\+O\+UT A\+NY W\+A\+R\+R\+A\+N\+TY; without even the implied warranty of M\+E\+R\+C\+H\+A\+N\+T\+A\+B\+I\+L\+I\+TY or F\+I\+T\+N\+E\+SS F\+OR A P\+A\+R\+T\+I\+C\+U\+L\+AR P\+U\+R\+P\+O\+SE. See the G\+NU General Public License for more details.

You should have received a copy of the G\+NU General Public License along with this program. If not, see \href{http://www.gnu.org/licenses/}{\tt http\+://www.\+gnu.\+org/licenses/}. 

\subsection{Function Documentation}
\index{printf.\+c@{printf.\+c}!\+\_\+printf\+\_\+fn@{\+\_\+printf\+\_\+fn}}
\index{\+\_\+printf\+\_\+fn@{\+\_\+printf\+\_\+fn}!printf.\+c@{printf.\+c}}
\subsubsection[{\texorpdfstring{\+\_\+printf\+\_\+fn(printf\+\_\+t $\ast$fn, \+\_\+\+\_\+memx const char $\ast$fmt, va\+\_\+list va)}{_printf_fn(printf_t *fn, __memx const char *fmt, va_list va)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} void \+\_\+printf\+\_\+fn (
\begin{DoxyParamCaption}
\item[{{\bf printf\+\_\+t} $\ast$}]{fn, }
\item[{{\bf \+\_\+\+\_\+memx} const char $\ast$}]{fmt, }
\item[{va\+\_\+list}]{va}
\end{DoxyParamCaption}
)}\hypertarget{printf_8c_a1c2762f15e2ae4dea9b52ee9e3532372}{}\label{printf_8c_a1c2762f15e2ae4dea9b52ee9e3532372}


vsnprintf function 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt out}  & {\em fn} & output character function pointer \\
\hline
\mbox{\tt in}  & {\em fmt} & printf forat string \\
\hline
\mbox{\tt in}  & {\em va} & va\+\_\+list arguments \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
size of string 
\end{DoxyReturn}
Calling Variadic Functions
\begin{DoxyItemize}
\item exceprt from \href{https://www.gnu.org/software/libc/manual/html_node/Calling-Variadics.html}{\tt https\+://www.\+gnu.\+org/software/libc/manual/html\+\_\+node/\+Calling-\/\+Variadics.\+html} Since the prototype doesn’t specify types for optional arguments, in a call to a variadic function the default argument promotions are performed on the optional argument values. This means the objects of type char or short int (whether signed or not) are promoted to either int or unsigned int, as appropriate; and that objects of type float are promoted to type double. So, if the caller passes a char as an optional argument, it is promoted to an int, and the function can access it with va\+\_\+arg (ap, int).
\end{DoxyItemize}

Definition at line 741 of file printf.\+c.



Referenced by fprintf(), snprintf(), tft\+\_\+printf(), uart0\+\_\+printf(), vsnprintf(), and vsock\+\_\+printf().

\index{printf.\+c@{printf.\+c}!\+\_\+putc\+\_\+buffer\+\_\+fn@{\+\_\+putc\+\_\+buffer\+\_\+fn}}
\index{\+\_\+putc\+\_\+buffer\+\_\+fn@{\+\_\+putc\+\_\+buffer\+\_\+fn}!printf.\+c@{printf.\+c}}
\subsubsection[{\texorpdfstring{\+\_\+putc\+\_\+buffer\+\_\+fn(struct \+\_\+printf\+\_\+t $\ast$p, char ch)}{_putc_buffer_fn(struct _printf_t *p, char ch)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} void \+\_\+putc\+\_\+buffer\+\_\+fn (
\begin{DoxyParamCaption}
\item[{struct {\bf \+\_\+printf\+\_\+t} $\ast$}]{p, }
\item[{char}]{ch}
\end{DoxyParamCaption}
)}\hypertarget{printf_8c_a9b6f7fa030ba96220b734d45d737805a}{}\label{printf_8c_a9b6f7fa030ba96220b734d45d737805a}


\+\_\+putc\+\_\+buffer\+\_\+fn -\/ character output to a string buffer Used by snprintf and vsnprintf You can make \+\_\+printf\+\_\+fn call this helper for each character 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em $\ast$p} & structure with pointers and buffer to be written to \\
\hline
\mbox{\tt in}  & {\em ch} & character to place in buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
void 
\end{DoxyReturn}


Definition at line 1103 of file printf.\+c.



Referenced by snprintf(), and vsnprintf().

\index{printf.\+c@{printf.\+c}!\+\_\+puts\+\_\+pad@{\+\_\+puts\+\_\+pad}}
\index{\+\_\+puts\+\_\+pad@{\+\_\+puts\+\_\+pad}!printf.\+c@{printf.\+c}}
\subsubsection[{\texorpdfstring{\+\_\+puts\+\_\+pad(printf\+\_\+t $\ast$fn, char $\ast$s, int width, int count, int left)}{_puts_pad(printf_t *fn, char *s, int width, int count, int left)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} void \+\_\+puts\+\_\+pad (
\begin{DoxyParamCaption}
\item[{{\bf printf\+\_\+t} $\ast$}]{fn, }
\item[{char $\ast$}]{s, }
\item[{int}]{width, }
\item[{int}]{count, }
\item[{int}]{left}
\end{DoxyParamCaption}
)}\hypertarget{printf_8c_ab713fa5c01f315bdf67d18a6dbcb4ff5}{}\label{printf_8c_ab713fa5c01f315bdf67d18a6dbcb4ff5}


Definition at line 683 of file printf.\+c.



Referenced by \+\_\+printf\+\_\+fn().

\index{printf.\+c@{printf.\+c}!bin2num@{bin2num}}
\index{bin2num@{bin2num}!printf.\+c@{printf.\+c}}
\subsubsection[{\texorpdfstring{bin2num(uint8\+\_\+t $\ast$str, int strmax, int nummin, int base, uint8\+\_\+t $\ast$nump, int numsize, int sign\+\_\+ch)}{bin2num(uint8_t *str, int strmax, int nummin, int base, uint8_t *nump, int numsize, int sign_ch)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} int bin2num (
\begin{DoxyParamCaption}
\item[{{\bf uint8\+\_\+t} $\ast$}]{str, }
\item[{int}]{strmax, }
\item[{int}]{nummin, }
\item[{int}]{base, }
\item[{{\bf uint8\+\_\+t} $\ast$}]{nump, }
\item[{int}]{numsize, }
\item[{int}]{sign\+\_\+ch}
\end{DoxyParamCaption}
)}\hypertarget{printf_8c_aa95ef42dcc41a90255c084e0e1a9bcde}{}\label{printf_8c_aa95ef42dcc41a90255c084e0e1a9bcde}


Convert an unsigned number (numsize bytes in size) to A\+S\+C\+II in specified base Notes\+: No limit except available memory on number size. 


\begin{DoxyItemize}
\item Does not use divide or of multiply instructions -\/ great on 8bit C\+PU\textquotesingle{}s How it works\+: Say you have a table of powers of 2 in a given base base
\item To get the result add each table entry, in the base, that corresponds to each 1 bit in the binary number.
\item Now instead of a table we can start with 1 and multiple by 2 contraining each digit into the base we want -\/ this is the same as using the table except we build it on the fly 
\begin{DoxyParams}[1]{Parameters}
\mbox{\tt out}  & {\em str} & A\+S\+C\+II number string result \\
\hline
\mbox{\tt in}  & {\em strmax} & maximum size of str in bytes \\
\hline
\mbox{\tt in}  & {\em nummin} & minimum number of digits to display \\
\hline
\mbox{\tt in}  & {\em $\ast$nump} & Pointer to binary number \\
\hline
\mbox{\tt in}  & {\em numsize} & size of binary number in bytes \\
\hline
\mbox{\tt in}  & {\em sign\+\_\+ch} & sign of binary number return converted number string numsize in bytes \\
\hline
\end{DoxyParams}

\end{DoxyItemize}

Definition at line 139 of file printf.\+c.



Referenced by p\+\_\+ntoa().

\index{printf.\+c@{printf.\+c}!isdigit@{isdigit}}
\index{isdigit@{isdigit}!printf.\+c@{printf.\+c}}
\subsubsection[{\texorpdfstring{isdigit(int c)}{isdigit(int c)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} int {\bf W\+E\+A\+K\+\_\+\+A\+TR} isdigit (
\begin{DoxyParamCaption}
\item[{int}]{c}
\end{DoxyParamCaption}
)}\hypertarget{printf_8c_a8c33a3f5b4322e705d3403f63d55b0a1}{}\label{printf_8c_a8c33a3f5b4322e705d3403f63d55b0a1}


test if a character is a digit 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em c} & character \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true or false 
\end{DoxyReturn}


Definition at line 70 of file printf.\+c.



Referenced by \+\_\+printf\+\_\+fn().

\index{printf.\+c@{printf.\+c}!p\+\_\+ntoa@{p\+\_\+ntoa}}
\index{p\+\_\+ntoa@{p\+\_\+ntoa}!printf.\+c@{printf.\+c}}
\subsubsection[{\texorpdfstring{p\+\_\+ntoa(uint8\+\_\+t $\ast$nump, int numsize, char $\ast$str, int strmax, int radix, int width, int prec, f\+\_\+t f)}{p_ntoa(uint8_t *nump, int numsize, char *str, int strmax, int radix, int width, int prec, f_t f)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} int p\+\_\+ntoa (
\begin{DoxyParamCaption}
\item[{{\bf uint8\+\_\+t} $\ast$}]{nump, }
\item[{int}]{numsize, }
\item[{char $\ast$}]{str, }
\item[{int}]{strmax, }
\item[{int}]{radix, }
\item[{int}]{width, }
\item[{int}]{prec, }
\item[{{\bf f\+\_\+t}}]{f}
\end{DoxyParamCaption}
)}\hypertarget{printf_8c_ab538bcf34e0347b5c0329666ab58d0e2}{}\label{printf_8c_ab538bcf34e0347b5c0329666ab58d0e2}


Convert number an base 2 .. 16 to A\+S\+C\+II with optional sign Notes\+: 1) Numbers can be any number of digits long -\/ limited only by memory available To print negative numbers convert to positive before calling this function and set f.\+b.\+neg 2) Warning\+: as with printf width and prec are only minimum sizes -\/ results can be bigger We assume all numbers are positive\+: 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em nump} & number pointer \\
\hline
\mbox{\tt in}  & {\em numsize} & number size in bytes \\
\hline
\mbox{\tt out}  & {\em $\ast$str} & string result \\
\hline
\mbox{\tt in}  & {\em strmax} & strmaximum length of string result \\
\hline
\mbox{\tt in}  & {\em radix} & Radix may be 2 .. 16 \\
\hline
\mbox{\tt in}  & {\em width} & Width of result padded if needed \\
\hline
\mbox{\tt in}  & {\em prec} & minumum number of digits, zero padded if needed \\
\hline
\mbox{\tt in}  & {\em f} & flags f.\+b.\+left justify left f.\+b.\+plus display + for positive number, -\/ for negative numbers f.\+b.\+space display \textquotesingle{} \textquotesingle{} for positive, -\/ for negative f.\+b.\+zero pad with zeros if needed f.\+b.\+alt Alternate display form -\/ work in progress f.\+b.\+width Width of result -\/ pad if required f.\+b.\+prec Zero padd to prec if sepcified f.\+b.\+neg Sign of number is negative \\
\hline
\end{DoxyParams}


Definition at line 314 of file printf.\+c.



Referenced by \+\_\+printf\+\_\+fn().

\index{printf.\+c@{printf.\+c}!pch@{pch}}
\index{pch@{pch}!printf.\+c@{printf.\+c}}
\subsubsection[{\texorpdfstring{pch(char ch)}{pch(char ch)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} int pch (
\begin{DoxyParamCaption}
\item[{char}]{ch}
\end{DoxyParamCaption}
)}\hypertarget{printf_8c_ab454b0d961c8dc93406cc75379c8a1f5}{}\label{printf_8c_ab454b0d961c8dc93406cc75379c8a1f5}


Put character in buffer with limits. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em str} & string \\
\hline
\mbox{\tt in}  & {\em max} & maximum number of characters plus E\+OS  init\+\_\+p\+\_\+ch \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
void 
\end{DoxyReturn}


Definition at line 237 of file printf.\+c.



Referenced by p\+\_\+ntoa().

\index{printf.\+c@{printf.\+c}!pch\+\_\+ind@{pch\+\_\+ind}}
\index{pch\+\_\+ind@{pch\+\_\+ind}!printf.\+c@{printf.\+c}}
\subsubsection[{\texorpdfstring{pch\+\_\+ind()}{pch_ind()}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} int pch\+\_\+ind (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\hypertarget{printf_8c_a642ddbb02955bf5cb540f7a2f0f09aae}{}\label{printf_8c_a642ddbb02955bf5cb540f7a2f0f09aae}


Return current index of character buffer with limits. 

\begin{DoxyReturn}{Returns}
Buffer index 
\end{DoxyReturn}


Definition at line 250 of file printf.\+c.



Referenced by p\+\_\+ntoa().

\index{printf.\+c@{printf.\+c}!pch\+\_\+init@{pch\+\_\+init}}
\index{pch\+\_\+init@{pch\+\_\+init}!printf.\+c@{printf.\+c}}
\subsubsection[{\texorpdfstring{pch\+\_\+init(char $\ast$str, int max)}{pch_init(char *str, int max)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} void pch\+\_\+init (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{str, }
\item[{int}]{max}
\end{DoxyParamCaption}
)}\hypertarget{printf_8c_ab10e941ecf6d7512649e377e97d28fac}{}\label{printf_8c_ab10e941ecf6d7512649e377e97d28fac}


Initialize character buffer with limits. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em str} & string \\
\hline
\mbox{\tt in}  & {\em max} & maximum number of characters plus E\+OS \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
void 
\end{DoxyReturn}
base of string to write to

current string index

maximum string size including E\+OS 

Definition at line 222 of file printf.\+c.



Referenced by p\+\_\+ntoa().

\index{printf.\+c@{printf.\+c}!pch\+\_\+max\+\_\+ind@{pch\+\_\+max\+\_\+ind}}
\index{pch\+\_\+max\+\_\+ind@{pch\+\_\+max\+\_\+ind}!printf.\+c@{printf.\+c}}
\subsubsection[{\texorpdfstring{pch\+\_\+max\+\_\+ind()}{pch_max_ind()}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} int pch\+\_\+max\+\_\+ind (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\hypertarget{printf_8c_a4188dbfea9bea20687558f35bc34c00d}{}\label{printf_8c_a4188dbfea9bea20687558f35bc34c00d}


Return maximum valid index for character buffer. 

\begin{DoxyReturn}{Returns}
Buffer index 
\end{DoxyReturn}


Definition at line 258 of file printf.\+c.

\index{printf.\+c@{printf.\+c}!print\+\_\+flags@{print\+\_\+flags}}
\index{print\+\_\+flags@{print\+\_\+flags}!printf.\+c@{printf.\+c}}
\subsubsection[{\texorpdfstring{print\+\_\+flags(f\+\_\+t f)}{print_flags(f_t f)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} void print\+\_\+flags (
\begin{DoxyParamCaption}
\item[{{\bf f\+\_\+t}}]{f}
\end{DoxyParamCaption}
)}\hypertarget{printf_8c_a9c08c55e823a7532f2344a77ef296b4e}{}\label{printf_8c_a9c08c55e823a7532f2344a77ef296b4e}


print flags set in t\+\_\+t structure 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em f} & \hyperlink{unionf__t}{f\+\_\+t} flags structure \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
void 
\end{DoxyReturn}


Definition at line 270 of file printf.\+c.

\index{printf.\+c@{printf.\+c}!reverse@{reverse}}
\index{reverse@{reverse}!printf.\+c@{printf.\+c}}
\subsubsection[{\texorpdfstring{reverse(char $\ast$str)}{reverse(char *str)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} void {\bf W\+E\+A\+K\+\_\+\+A\+TR} reverse (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{str}
\end{DoxyParamCaption}
)}\hypertarget{printf_8c_a00b9d97be21e4f3f5df1019a803c05a6}{}\label{printf_8c_a00b9d97be21e4f3f5df1019a803c05a6}


Reverse a string in place Example\+: abcdef -\/$>$ fedcba. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em str} & string \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
string length 
\end{DoxyReturn}


Definition at line 88 of file printf.\+c.



Referenced by bin2num().

\index{printf.\+c@{printf.\+c}!snprintf@{snprintf}}
\index{snprintf@{snprintf}!printf.\+c@{printf.\+c}}
\subsubsection[{\texorpdfstring{snprintf(char $\ast$str, size\+\_\+t size, const char $\ast$format,...)}{snprintf(char *str, size_t size, const char *format,...)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} int snprintf (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{str, }
\item[{{\bf size\+\_\+t}}]{size, }
\item[{const char $\ast$}]{format, }
\item[{}]{...}
\end{DoxyParamCaption}
)}\hypertarget{printf_8c_a278630a290b34d009b2e3ad7bf1fc996}{}\label{printf_8c_a278630a290b34d009b2e3ad7bf1fc996}


snprintf function 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt out}  & {\em str} & string buffer for result \\
\hline
\mbox{\tt in}  & {\em size} & maximum length of converted string \\
\hline
\mbox{\tt in}  & {\em format} & printf forat string \\
\hline
\mbox{\tt in}  & {\em ...} & list of arguments \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
string size 
\end{DoxyReturn}


Definition at line 1164 of file printf.\+c.

\index{printf.\+c@{printf.\+c}!strlen@{strlen}}
\index{strlen@{strlen}!printf.\+c@{printf.\+c}}
\subsubsection[{\texorpdfstring{strlen(const char $\ast$str)}{strlen(const char *str)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} {\bf size\+\_\+t} {\bf W\+E\+A\+K\+\_\+\+A\+TR} strlen (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{str}
\end{DoxyParamCaption}
)}\hypertarget{printf_8c_a895ea3a2f9901e4c962806cc15271339}{}\label{printf_8c_a895ea3a2f9901e4c962806cc15271339}


String Length. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em str} & string \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
string length 
\end{DoxyReturn}


Definition at line 53 of file printf.\+c.



Referenced by \+\_\+printf\+\_\+fn(), p\+\_\+ntoa(), reverse(), snprintf(), and vsnprintf().

\index{printf.\+c@{printf.\+c}!strupper@{strupper}}
\index{strupper@{strupper}!printf.\+c@{printf.\+c}}
\subsubsection[{\texorpdfstring{strupper(char $\ast$str)}{strupper(char *str)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} void {\bf W\+E\+A\+K\+\_\+\+A\+TR} strupper (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{str}
\end{DoxyParamCaption}
)}\hypertarget{printf_8c_a25ac5a1dbdfa1d06d55448cd7b665d1d}{}\label{printf_8c_a25ac5a1dbdfa1d06d55448cd7b665d1d}


U\+P\+P\+E\+R\+C\+A\+SE a string. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em str} & string \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
void 
\end{DoxyReturn}


Definition at line 109 of file printf.\+c.



Referenced by \+\_\+printf\+\_\+fn().

\index{printf.\+c@{printf.\+c}!vsnprintf@{vsnprintf}}
\index{vsnprintf@{vsnprintf}!printf.\+c@{printf.\+c}}
\subsubsection[{\texorpdfstring{vsnprintf(char $\ast$str, size\+\_\+t size, const char $\ast$format, va\+\_\+list va)}{vsnprintf(char *str, size_t size, const char *format, va_list va)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} int vsnprintf (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{str, }
\item[{{\bf size\+\_\+t}}]{size, }
\item[{const char $\ast$}]{format, }
\item[{va\+\_\+list}]{va}
\end{DoxyParamCaption}
)}\hypertarget{printf_8c_a7a6349b4ca3388a0cb82fc3d1d85a6b5}{}\label{printf_8c_a7a6349b4ca3388a0cb82fc3d1d85a6b5}


vsnprintf function 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt out}  & {\em str} & string buffer for result \\
\hline
\mbox{\tt in}  & {\em size} & maximum length of converted string \\
\hline
\mbox{\tt in}  & {\em format} & printf forat string \\
\hline
\mbox{\tt in}  & {\em va} & va\+\_\+list list of arguments \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
string size 
\end{DoxyReturn}


Definition at line 1135 of file printf.\+c.



Referenced by html\+\_\+msg(), and snprintf().



\subsection{Variable Documentation}
\index{printf.\+c@{printf.\+c}!\+\_\+pch@{\+\_\+pch}}
\index{\+\_\+pch@{\+\_\+pch}!printf.\+c@{printf.\+c}}
\subsubsection[{\texorpdfstring{\+\_\+pch}{_pch}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf p\+\_\+ch\+\_\+t} \+\_\+pch}\hypertarget{printf_8c_aa1e6944673f3194dc3fe8ba626deec55}{}\label{printf_8c_aa1e6944673f3194dc3fe8ba626deec55}


Define data structure for character buffer with limits. 



Definition at line 215 of file printf.\+c.

